<?php 
include('header.php');
include('menu.php');
include('config.php');
include_once('connection/connection.php');
function getName($colName,$id)
{
	$sqlgetName="select distinct ".$colName."_name from tbl_lookup_location where ".$colName."_id=".$id;
	$querygetName=mysql_query($sqlgetName);
	$rowgetName=mysql_fetch_row($querygetName);
	return $rowgetName[0];
}
$sc=$_REQUEST['scheme'];
if($sc==1)
{
 $sc="P&T";
}
if($sc==2)
{
 $sc="Piped";
}
if($sc==3)
{
 $sc="RWSS";
}
if($sc==4)
{
 $sc="Sanitary Diggs";
}
//if($sc==5)
//{
// $sc="HP";
//}
if(isset($_POST['submit']))
{ 
	$District_id=$_POST['district'];
	//$_SESSION['district']=$district;
	$Block_id=$_POST['form_id'];
	//$_SESSION['form_id']=$form_id;
	if($sc=="RWSS")
	{
		header('Location:ListRWSSscheme.php?DT='.$District_id.' && BC='.$Block_id.' && TS='.$sc.' && s='.$_REQUEST['scheme'].'');
	}
	else
	{
		header('Location:ListPTscheme.php?DT='.$District_id.' && BC='.$Block_id.' && TS='.$sc.' && s='.$_REQUEST['scheme'].'');
	}
}	
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/style_question.css" type="text/css" rel="stylesheet" />
<script language="javascript" type="text/javascript" src="js/validate.js"></script>
<script language="Javascript" type="text/javascript" src="schemewiseListQ.js"></script>
<script language="javascript" type="text/javascript">
function validate()
{
	valid = true;
	if (document.view_main_q1.district.selectedIndex == 0)
    {
        alert ( "Please select District Name" );
        valid = false;
    }
	if (document.view_main_q1.form_id.selectedIndex == 0)
    {
        alert ( "Please select Form Id" );
        valid = false;
    }
	return valid;
}	
</script>
<title>P&T</title>
</head>
<body>
<div align="center">
<form action="" method="post" enctype="multipart/form-data" onSubmit="return validate()" name="view_main_q1">
<table border="0" width="746" id="table1" cellspacing="0" cellpadding="0" style="padding:10px;">
	<tr bgcolor="FF9966">
		<td height="29" align="left" valign="top" bgcolor="#C5D8EB" colspan="5">&nbsp;</td>
	</tr>
	<tr>
	<td height="32" colspan="5" align="center" bgcolor="#E5E5E5" style="padding-top:5px">
	<span lang="en-us">&nbsp;</span><span lang="en-us" style="font-size: 8.5pt"><font face="Verdana" color="#006699"><b><?php if($sc=="P&T"){ echo "P&T/TSS(P&T)";}elseif($sc=="Sanitary Diggs"){ echo "Sanitary Diggi";}else{ echo $sc;}?> scheme wise list</b></font></span></td>
</tr>

<tr><td align="left" colspan="5">&nbsp;</td>
</tr>
		<tr>
			<td width="131" height="27" align="right">
					<font face="Verdana" style="font-size: 8.5pt" color="#000000">District&nbsp;&nbsp;&nbsp;&nbsp;</font></td>
			<td width="160">
			<?php
			 if($sc=="P&T"){
		       $query="select DISTINCT district_id from tbl_dtls_q1_main where type_scheme='P&T' or type_scheme='TSS(P&T)'";
		          }else{
		       $query="select DISTINCT district_id from tbl_dtls_q1_main where type_scheme='$sc'";
		          }
               $result=mysql_query($query);
               $dist_name = array();
			                                  while(list($id)=mysql_fetch_array($result))
		                                         {
                                                    $dist_name[$id]=getName('district',$id);
                                                 }
		  asort($dist_name);
		  echo "<select name='district' id='district' class='txt' onChange=\"changeForm('form_id',this.value,'$sc')\">\n";
          echo "<option value='0'>==== District ====</option>\n";
		    foreach($dist_name as $key=>$val)
			{
			echo "<option value=\"$key\">".$val."</option> \n" ;
			}
           
		  echo "</select>";
		  ?></td>
			<td width="43"><font style="font-size: 8.5pt" face="Verdana" color="#000000">Block</font></td>
			<td width="175"><font id="form_id">
		  	<select name="form_id" id="form_id" class="txt">
				<option value="0">=====Block=====</option>
       	  </select></font><span id="formLoader"></span></td>
		    <td width="237"><input type="submit" value="view" name="submit" onClick="view_validate()"></td>
		</tr>
		<tr>
			<td colspan="5">&nbsp;</td>
		</tr>
		<tr>
			<td colspan="5">&nbsp;</td>
		</tr>
		
		<tr>
			<td colspan="5">
			<p align="center">
			&nbsp;</p></td>
		</tr>
	</table>
</form>
</div>
</body>
</html>
